/**
 * @Title:  AttentionDynamicsActivity.java 
 * @Copyright:  XXX Co., Ltd. Copyright YYYY-YYYY,  All rights reserved 
 * @Description:  TODO<请描述此文件是做什么的> 
 * @author:  MeiYi 
 * @data:  2015-12-7 上午10:20:14 
 * @version:  V1.0 
 */

package artid.com.arttogoa.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import artid.com.arttogoa.R;
import artid.com.arttogoa.glide.GlideUtil;
import artid.com.arttogoa.parser.MapBean;
import artid.com.arttogoa.task.CallbackSky;

/**
 * TODO<请描述这个类是干什么的>
 * 
 * @author 熊彬
 * @data: 2015-12-7 上午10:20:14
 * @version: V1.0
 */
public class MicroscopicMapFragment extends Fragment implements OnClickListener {
	private TextView mTextView;
	private ImageView mImageView;
	private MapBean data;
	private CallbackSky call;

	public MicroscopicMapFragment(CallbackSky call) {
		this.call = call;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater,
	 * android.view.ViewGroup, android.os.Bundle)
	 */
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View v = inflater.inflate(R.layout.viewpager_mic_item, null);
		mTextView = (TextView) v.findViewById(R.id.tv_edit);
		mImageView = (ImageView) v.findViewById(R.id.iv_img);
		mTextView.setOnClickListener(this);
		// adapter = new AuctionAdapter(getActivity());
		data = (MapBean) getArguments().getSerializable("data");
		GlideUtil.setImage1(getActivity(), data.getUrl(), R.drawable.yspba_img_mor,
				R.drawable.yspba_img_mor, mImageView);
//		Glide.with(MicroscopicMapFragment.this).load(new File(data.getUrl()))
//				.placeholder(R.drawable.yspba_img_mor)
//				.error(R.drawable.yspba_img_mor).into(mImageView);
		// mImageView.setImageBitmap(getLoacalBitmap(data.getImage()));
		
		return v;
	}

	/**
	 * 加载本地图片 http://bbs.3gstdy.com
	 * 
	 * @param url
	 * @return
	 */
	// public Bitmap getLoacalBitmap(String url) {
	// try {
	// FileInputStream fis = new FileInputStream(url);
	// Bitmap bitmap = BitmapFactory.decodeStream(fis);
	// return bitmap;
	// } catch (FileNotFoundException e) {
	// e.printStackTrace();
	// return null;
	// }
	// }

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View view) {
		// TODO Auto-generated method stub
		switch (view.getId()) {
		case R.id.tv_edit:
			call.callBack(data.getId());
			break;

		default:
			break;
		}
	}
}
